home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / liboctave / cmd-hist.h < prev    next >
C/C++ Source or Header  |  1997-03-07  |  3KB  |  126 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. #if !defined (octave_cmd_hist_h)
  24. #define octave_cmd_hist_h 1
  25.  
  26. #include <string>
  27.  
  28. #include "str-vec.h"
  29.  
  30. class
  31. command_history
  32. {
  33. public:
  34.  
  35.   command_history (const string& = string (), int = -1);
  36.  
  37.   ~command_history (void) { initialized = false; }
  38.  
  39.   void set_file (const string&);
  40.  
  41.   string file (void);
  42.  
  43.   void set_size (int);
  44.  
  45.   int size (void);
  46.  
  47.   void ignore_entries (bool = true);
  48.  
  49.   bool ignoring_entries (void);
  50.  
  51.   void add (const string&);
  52.  
  53.   void remove (int);
  54.  
  55.   int where (void);
  56.  
  57.   int base (void);
  58.  
  59.   int current_number (void);
  60.  
  61.   void stifle (int);
  62.  
  63.   int unstifle (void);
  64.  
  65.   int is_stifled (void);
  66.  
  67.   void read (bool = true);
  68.  
  69.   void read (const string&, bool = true);
  70.  
  71.   void read_range (int = -1, int = -1, bool = true);
  72.  
  73.   void read_range (const string&, int = -1, int = -1,
  74.            bool = true);
  75.  
  76.   void write (const string& = string ());
  77.  
  78.   void append (const string& = string ());
  79.  
  80.   void truncate_file (const string& = string (), int = -1);
  81.  
  82.   string_vector list (int = -1, int = 0);
  83.  
  84.   string get_entry (int);
  85.  
  86.   void replace_entry (int, const string&);
  87.  
  88.   void clean_up_and_save (const string& = string (), int = -1);
  89.  
  90. private:
  91.  
  92.   // We can only have one history object in any given program.
  93.   static bool initialized;
  94.  
  95.   // TRUE means we are ignoring new additions.
  96.   bool ignoring_additions;
  97.  
  98.   // The number of hisory lines we read from the history file.
  99.   int lines_in_file;
  100.  
  101.   // The number of history lines we've saved so far.
  102.   int lines_this_session;
  103.  
  104.   // The default history file.
  105.   string xfile;
  106.  
  107.   // The number of lines of history to save.
  108.   int xsize;
  109.  
  110.   void error (int);
  111.  
  112.   void error (const string&);
  113.  
  114.   command_history (const command_history&);
  115.  
  116.   command_history& operator = (const command_history&);
  117. };
  118.  
  119. #endif
  120.  
  121. /*
  122. ;;; Local Variables: ***
  123. ;;; mode: C++ ***
  124. ;;; End: ***
  125. */
  126.